package com.ydc.ln.tutorial.gui.app.spider;

import javax.swing.ButtonGroup;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JRadioButtonMenuItem;

/**
 * 
 * @author ydc
 * @date 下午3:20:26 2013-5-19
 */
public class MenuView extends JMenuBar{

    /**
     * @Fields serialVersionUID 
     */ 
    private static final long serialVersionUID = -2367131591937033759L;
    public MenuView() {
        /** 声明组件 */
        // 菜单组
        JMenu menuFile = new JMenu("游戏");
        JMenu menuEdit = new JMenu("帮助");
        JMenu menuView = new JMenu("查看");
        // 菜单项
        JMenuItem itemFileNew = new JMenuItem("新建");
        JMenuItem itemFileOpen = new JMenuItem("打开");
        JMenuItem itemFileExit = new JMenuItem("退出");
        JMenuItem itemEditFind = new JMenuItem("查找");
        JMenuItem itemViewShow = new JMenuItem("显示");
        // 单选框
        ButtonGroup group = new ButtonGroup();
        JRadioButtonMenuItem radio1 = new JRadioButtonMenuItem("简单：单一花色");
        JRadioButtonMenuItem radio2 = new JRadioButtonMenuItem("中级：双花色");
        JRadioButtonMenuItem radio3 = new JRadioButtonMenuItem("高级：四花色");
    
        /** 设置组件 */
        radio1.setSelected(true);
        group.add(radio1);
        group.add(radio2);
        group.add(radio3);
        
        /** 添加组件 */
        menuFile.add(itemFileNew);
        menuFile.add(itemFileOpen);
        menuFile.addSeparator();
        menuFile.add(radio1);
        menuFile.add(radio2);
        menuFile.add(radio3);
        menuFile.addSeparator();
        menuFile.add(itemFileExit);
        menuEdit.add(itemEditFind);
        menuView.add(itemViewShow);
        this.add(menuFile);
        this.add(menuEdit);
        this.add(menuView);
    }
}
